<%@ include file="/WEB-INF/jsp/taglib.jsp" %>

<jsp:useBean id="actionBean" scope="request" type="com.rupertjones.globalcron.web.EditJobAction" />

<s:layout-render name="/WEB-INF/jsp/layout.jsp" title="Global Cron" subtitle="Edit Job">
    <s:layout-component name="body">

    <s:form action="EditJob.action" beanclass="com.rupertjones.globalcron.web.EditJobAction">
        <s:errors/>

        <h1>Edit Job</h1>
        <div style="text-align: right; border:1px; width:100%; padding-bottom:10px;"><a title="Delete Job" href="DeleteJob.action?job.id=${actionBean.job.id}"><img src="resources/delete.png" border="0"/></a></div>
        <table class="rounded-corner" align="center">
            <s:hidden name="job.id"/>
            <tr>
                <td>Name</td>
                <td>
                    <s:text name="job.name" style="width:240px;"/>
                </td>
            </tr>
            <tr>
                <td>Host</td>
                <td>
                 <s:select name="job.host" value="${actionBean.job.host.id}">
                    <s:option value="">Select One</s:option>
                    <s:options-collection collection="${actionBean.hosts}" value="id" label="description"/>
                 </s:select>
                </td>
            </tr>
            <tr>
                <td>Timezone</td>
                <td>
                 <s:select name="job.timezone" value="${actionBean.job.timezone}">
                    <s:option value="">Select One</s:option>
                    <s:options-collection collection="${actionBean.currentlyUsedTimezones}" value="id"/>
                    <s:option value="">==================================</s:option>
                    <s:options-collection collection="${actionBean.timezones}" value="id"/>
                 </s:select>
                </td>
            </tr>
            <tr>
                <td>Cron Expression (<a href="http://www.quartz-scheduler.org/docs/tutorials/crontrigger.html" target="new">?</a>)</td>
                <td>
                    <s:text name="job.cron" style="width:240px;"/>
                </td>
            </tr>
            <tr>
                <td>Script Path</td>
                <td>
                    <s:text name="job.script" style="width:240px;"/>
                </td>
            </tr>
            <tr>
                <td>Wait time after execution (millis)</td>
                <td>
                    <s:text name="job.waitAfter" style="width:240px;"/>
                </td>
            </tr>
            <tr>
                <td>Save Output ?</td>
                <td>
                    <s:checkbox name="job.saveOutput"/>
                </td>
            </tr>
            <tr>
                <td>Wait for Completion ?</td>
                <td>
                    <s:checkbox name="job.waitForCompletion"/>
                </td>
            </tr>
            <c:if test="${actionBean.allowAdHocExecution}">
                <tr>
                    <td>Allow Adhoc Execution ?</td>
                    <td>
                    <s:checkbox name="job.allowAdhocExec" />
                    </td>
                </tr>
            </c:if>
            <tr>
                <td>Enabled ?</td>
                <td>
                    <s:checkbox name="job.enabled" />
                </td>
            </tr>
            <tr>
                <td colspan="2"><s:submit name="SaveOrUpdate" value="Save"/></td>
            </tr>
        </table>
        <p/>
    </s:form>

    </s:layout-component>
</s:layout-render>
